//
// Created by wkm on 2023-12-12.
//

#include "upc_wait.h"

void upc_wait::prc_upc_wait() {
    // 永远不会跳出该进程
    while (1) {
        wait();

        if (res) {
            dout = 0;
        }
        wait();

        if (ld) {
            dout = din;

            while (!stop) {
                wait();

                if (up) {
                    dout = dout.read() + incr.read();
                } else {
                    dout = dout.read() - incr.read();
                }
            }
        }
    }
}